package persistencia;

import org.hibernate.SQLQuery;

import persistencia.base.GenericDAOAbstract;

import dominio.Usuario;


public class UsuarioDAOImpl extends GenericDAOAbstract<Usuario, Long> implements UsuarioDAO {

	public Object verificaLogin(String login, String password) {
//		
//		String hql = "from Pessoa p where p.cpf like :cpf";
//		Query hqlQuery = getSession().createQuery(hql);
//		hqlQuery.setParameter("cpf", cpf);
//		return (Pessoa) hqlQuery.uniqueResult();
		login = login.toUpperCase(); 
		Object objt = new Object();
		objt = null;
		String sql = "SELECT * FROM usuario c where c.senha like  '" + password + "' and c.nome like  '" + login + "'";
		SQLQuery sqlQuery = getSession().createSQLQuery(sql);
		objt = sqlQuery.uniqueResult();

		return objt;
		
	}
}